package com.demoLearn;

import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @description:
 * @author: tutu
 **/
public class java_string {
    public static void main(String[] args) {
        //System.out.println("shitutuya:"+"4102".substring(0,4));

        /*
        Map<String, Object> params = new HashMap();
        params.put("cyy","name");
        if(params.get("cy")!=null && !params.get("cy").toString().equals("")){
            System.out.println("shitutuya:"+true);
        }else {
            System.out.println("shitutuya:"+false);
        }
        String cy = params.get("cy")!=null ? "0" : "1";
        System.out.println("shitutuya:"+cy);
        */


        /*
        String msg="100|84|0|91|100|100|99|100|0|0|100";
        String[] split = msg.split("\\|");
        for (int i=0;i<split.length;i++){
            System.out.println("shitutuya:"+split[i]);
        }*/

        //字符串相加测试
     /* String a1=null;
        String a=a1+"lovetutuya";
        System.out.println("shitutuya:"+a);*/

        //Set能否添加空？ ok all element null 不重复
      /*  Set<String> a=new HashSet<>();
        a.add(null);
        a.add(null);
        System.out.println("shitutuya:"+a.size());*/

        //字符串转换为2进制
       /* String xx=Integer.toBinaryString(16);
        List<Integer> list=new ArrayList<>();
        for(int i=0;i<xx.length();i++){
            char c = xx.charAt(i);
            if(c == 1){
            }
            list.add((int) xx.charAt(i));
            Collections.reverse(list);
            System.out.println("shitutuya1:"+list.size());
        }
        System.out.println("shitutuya:"+xx);*/


        //字符串替换及indexof

        /*String xx="000100";
        String xx1=xx.replaceAll("0","");
        if( xx1.length() ==1){
            System.out.println("shitutuya:"+xx+"==="+xx.indexOf("1"));
        }*/

        //集合的size 0二进制的长度 1
        /*System.out.println("size:"+new ArrayList<>().size());

        String tableItem=Integer.toBinaryString(0);
        String valueReplace =tableItem.replaceAll("0","");
        System.out.println("length:"+valueReplace.length()+"===length2:"+tableItem.length());*/


        //获取当前时间年月
        /*Calendar cal = Calendar.getInstance();
        int year = cal.get(Calendar.YEAR);
        String month = cal.get(Calendar.MONTH )+1 < 10 ? "0"+(cal.get(Calendar.MONTH )+1) : cal.get(Calendar.MONTH )+1+"";
        System.out.println("shitutuya:"+year + "-" +month);*/




        /*Calendar cal = Calendar.getInstance();

        SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM");

        cal.add(cal.MONTH, -1);

        String Month = dft.format(cal.getTime());

        System.out.println("Month:"+Month);*/

      /*  Calendar cal = Calendar.getInstance();

        SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM");

        cal.add(cal.DAY_OF_MONTH, -1);

        String Month = dft.format(cal.getTime());

        System.out.println("Month:"+Month);*/


       /* SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MONTH,-1);
        System.out.println("Month:"+sdf.format(cal.getTime()));*/



      /*  String[] a= {""};
        if(a[0].equals("")){
            System.out.println("shitutuya:==="+a[0]);
        }else {
            System.out.println("shitutuya:");
        }*/

        //时间的分割
        String valeue="2020-05-05 00:00:00.0";
        System.out.println("shitutuya:"+valeue.length());
        System.out.println("shitutuya:"+valeue.substring(0,19));

     /*   System.out.println("shitutuya:"+"1".equals("1"));*/
    }
}
